﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using MailMergeToolForm.MailMergeService;
using MailMergeToolForm.MenuForm;
using MailMergeToolForm.MenuForm.Fast;
using MailMergeToolForm.MenuForm.File;

namespace MailMergeToolForm
{
    public partial class MailMergeReplace : Form
    {
        public MailMergeReplace()
        {
            InitializeComponent();
            txtPathSource.ReadOnly = true;
            txtPathDestination.ReadOnly = true;
        }

        private void btn_ChoosePathSource_Click(object sender, EventArgs e)
        {
            openFileSource.Filter = "MicroSoft Word (.doc)|*.doc";
            openFileSource.FilterIndex = 1;
            if(openFileSource.ShowDialog() == DialogResult.OK)
            {
                txtPathSource.Text = openFileSource.FileName ?? null;
            }
        }

        private void btn_ChoosePathDestination_Click(object sender, EventArgs e)
        {
            if(folderBrowserDestination.ShowDialog() == DialogResult.OK)
            {
                txtPathDestination.Text = folderBrowserDestination.SelectedPath;
            }
        }

        private void btn_Execute_Click(object sender, EventArgs e)
        {
            ServiceClient myServiceMailMegre =  new ServiceClient();
            myServiceMailMegre.ReplaceMailMerge(txtSource.Text, txtDestionation.Text, txtPathSource.Text,
                                                txtPathDestination.Text);
        }

        private void multiFileToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frMultiFileMailMerge frMultiFile =  new frMultiFileMailMerge();
            frMultiFile.ShowDialog();
        }

        private void genCaseToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frGenCase frGenCase =  new frGenCase();
            frGenCase.ShowDialog();
        }

        private void waterMaskMultiToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frMultiFileWatermask frwatermask = new frMultiFileWatermask();
            frwatermask.ShowDialog();
        }
    }
}
